home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / CURSPRIV.H < prev    next >
Text File  |  1993-01-18  |  10KB  |  280 lines

  1. /*
  2. * $Header: c:/curses/RCS/curspriv.h%v 2.0 1992/11/16 22:40:39 MH Rel $
  3. *
  4. *                          CURSPRIV.H
  5. *
  6. * Header file for definitions and declarations for the
  7. * PDCurses package. These definitions should not be generally
  8. * accessible to programmers, but are provided if the applications
  9. * programmer decides to make the decision in favor of speed on a
  10. * PC over portability.
  11. *
  12. * Revision History:
  13. * Frotz 1.5Beta 900714  Added many levels of compiler support.
  14. *                       Added mixed prototypes for all "internal" routines.
  15. *                       Removed all assembly language.  Added EGA/VGA
  16. *                       support.  Converted all #ifdef to #if in all
  17. *                       modules except CURSES.H and CURSPRIV.H.
  18. *                       Always include ASSERT.H.  Added support for an
  19. *                       external malloc(), calloc() and free().
  20. *                       Added support for FAST_VIDEO (direct-memory writes).
  21. *                       Added various memory model support (for FAST_VIDEO).
  22. *                       Added much of the December 1988 X/Open Curses
  23. *                       specification.
  24. * bl    1.3     881005  All modules lint-checked with MSC '-W3' and turbo'C'
  25. *                       '-w -w-pro' switches.
  26. * bl    1.2     881002  Support (by #ifdef UCMASM) for uppercase-only
  27. *                       assembly routine names. If UCMASM if defined,
  28. *                       all assembler names are #defined as upper case.
  29. *                       Not needed if you do "MASM /MX. Also missing
  30. *                       declaration of cursesscroll(). Fixes thanks to
  31. *                       N.D. Pentcheff
  32. * bl    1.1     880306  Add _chadd() for raw output routines.
  33. * bl    1.0     870515  Release.
  34. *
  35. */
  36.  
  37. #ifndef __CURSES_INTERNALS__
  38. #define __CURSES_INTERNALS__
  39.  
  40. /* Always include... */
  41. #include <assert.h>
  42.  
  43. /*----------------------------------------------------------------------
  44. *       OPERATING SYSTEM SUPPORT:
  45. *
  46. *               DOS             The one we all know and love:-}
  47. *               OS/2            The new kid on the block.
  48. *               FLEXOS          A Real-time, protected-mode OS from
  49. *                               Digital Research, Inc.
  50. *                              (AKA, the 4680 from IBM...)
  51. */
  52.  
  53. /*----------------------------------------*/
  54. #ifdef  DOS
  55. #  define FAST_VIDEO 1          /* We can write directly to the screen. */
  56.    typedef union REGS Regs;
  57.    extern Regs regs;
  58. #endif
  59.  
  60. /*----------------------------------------*/
  61. #ifdef  FLEXOS
  62. #  define FAST_VIDEO 1          /* We can use scopy()   */
  63. #  define GMODE  0 /* KLUDGE ALERT!
  64.                    * GMODE == 0 defines character mode structures in FLEXTAB.H.
  65.                    * GMODE == 1 defines graphics  mode structures in FLEXTAB.H.
  66.                    */
  67. #include <flextab.h>
  68. extern VIRCON vir;
  69. #endif
  70.  
  71.  
  72.  
  73.  
  74. /*----------------------------------------------------------------------
  75. *       MEMORY MODEL SUPPORT:
  76. *
  77. *       MODELS
  78. *               TINY            cs,ds,ss all in 1 segment (not enough memory!)
  79. *               SMALL           cs:1 segment,           ds:1 segment
  80. *               MEDIUM          cs:many segments        ds:1 segment
  81. *               COMPACT         cs:1 segment,           ds:many segments
  82. *               LARGE           cs:many segments        ds:many segments
  83. *               HUGE            cs:many segments        ds:segments > 64K
  84. */
  85. #ifdef  __TINY__
  86. #  define SMALL 1
  87. #endif
  88. #ifdef  __SMALL__
  89. #  define SMALL 1
  90. #endif
  91. #ifdef  __MEDIUM__
  92. #  define MEDIUM 1
  93. #endif
  94. #ifdef  __COMPACT__
  95. #  define COMPACT 1
  96. #endif
  97. #ifdef  __LARGE__
  98. #  define LARGE 1
  99. #endif
  100. #ifdef  __HUGE__
  101. #  define HUGE 1
  102. #endif
  103.  
  104.  
  105.  
  106.  
  107. /*----------------------------------------------------------------------
  108. *       MALLOC DEBUGGING SUPPORT:
  109. *
  110. *       Set EMALLOC and EMALLOC_MAGIC in order to use your private
  111. *       versions of malloc(), calloc(), and free().  This can help,
  112. *       but not solve, your malloc problems when debugging...
  113. *
  114. */
  115. #ifndef        INTERNAL
  116. #  define EMALLOC 0             /* Disable External Malloc             */
  117. #else
  118. #  define EMALLOC 0             /* Enable/Disable External Malloc       */
  119. #  define EMALLOC_MAGIC  0x0C0C /* Our magic indicator that we should   */
  120.                                 /* use our external malloc rather than  */
  121.                                 /* the runtime's malloc.                */
  122. #endif
  123.  
  124.  
  125. /*----------------------------------------------------------------------*/
  126. /* window properties */
  127. #define _SUBWIN         0x01    /* window is a subwindow            */
  128. #define _ENDLINE        0x02    /* last winline is last screen line */
  129. #define _FULLWIN        0x04    /* window fills screen              */
  130. #define _SCROLLWIN      0x08    /* window lwr rgt is screen lwr rgt */
  131. #define _PAD            0x10    /* X/Open Pad.                      */
  132.  
  133.  
  134.  
  135.  
  136. /*----------------------------------------------------------------------*/
  137. /* Miscellaneous */
  138. #define _INBUFSIZ       512     /* size of terminal input buffer */
  139. #define _NO_CHANGE      -1      /* flags line edge unchanged     */
  140.  
  141.  
  142.  
  143.  
  144. /* @@@ THESE SHOULD BE INDIVIDUAL FUNCTIONS, NOT MACROS! */
  145. #define _ECHAR          0x08    /* Erase char      (^H)         */
  146. #define _DWCHAR         0x17    /* Delete Word char (^W)         */
  147. #define _DLCHAR         0x15    /* Delete Line char (^U)         */
  148. #define _GOCHAR         0x11    /* ^Q character                  */
  149. #define _PRINTCHAR      0x10    /* ^P character                  */
  150. #define _STOPCHAR       0x13    /* ^S character                  */
  151. #define  NUNGETCH       20      /* max # chars to ungetch()      */
  152.  
  153.  
  154.  
  155.  
  156. /* Setmode stuff */
  157. struct cttyset
  158. {
  159.        bool    been_set;
  160.        SCREEN  saved;
  161. };
  162.  
  163. extern struct cttyset c_sh_tty;         /* tty modes for shell_mode */
  164. extern struct cttyset c_pr_tty;         /* tty modes for prog_mode  */
  165. extern struct cttyset c_save_tty;
  166. extern struct cttyset c_save_trm;
  167.  
  168. /* Printscan stuff */
  169. extern char c_printscanbuf[];           /* buffer used during I/O */
  170.  
  171. /* Strget stuff */
  172. extern char*    c_strbeg;
  173.  
  174. /* doupdate stuff */
  175. extern WINDOW*  twin;                   /* used by many routines */
  176.  
  177. /* Monitor (terminal) type information */
  178. #define _NONE           0x00
  179. #define _MDA            0x01
  180. #define _CGA            0x02
  181. #define _EGACOLOR       0x04
  182. #define _EGAMONO        0x05
  183. #define _VGACOLOR       0x07
  184. #define _VGAMONO        0x08
  185. #define _MCGACOLOR      0x0a
  186. #define _MCGAMONO       0x0b
  187. #define _FLEXOS         0x20            /* A Flexos console */
  188. #define _MDS_GENIUS     0x30
  189.  
  190. /* Text-mode font size information */
  191. #define _FONT8  8
  192. #define _FONT14 14
  193. #define _FONT15 15              /* GENIUS */
  194. #define _FONT16 16
  195.  
  196.  
  197. /*----------------------------------------------------------------------
  198. *       ANSI C prototypes.  Be sure that your compiler conditional
  199. *       compilation definitions above define ANSI to be non-zero
  200. *       if you compiler supports prototypes.
  201. */
  202. #ifdef     ANSI
  203. #  ifdef  CPLUSPLUS
  204.      extern "C" {
  205. #  endif
  206. bool   PDC_check_bios_key( void );
  207. bool   PDC_get_ctrl_break( void );
  208. bool   PDC_transformline( int );
  209. chtype PDC_validchar( chtype );
  210. int    PDC_backchar( WINDOW*, char*, int* );
  211. int    PDC_scr_open( SCREEN*, bool );
  212. int    PDC_scr_close( void );
  213. int    PDC_get_cursor_pos( int*, int* );
  214. int    PDC_get_columns( void );
  215. int    PDC_scroll( int, int, int, int, int, chtype );
  216. int    PDC_set_ctrl_break( bool );
  217. int    PDC_clr_update( WINDOW* );
  218. int    PDC_chadd( WINDOW*, chtype, bool, bool );
  219. int    PDC_chins( WINDOW*, chtype, bool );
  220. #ifdef     OS2
  221. VIOCONFIGINFO  PDC_query_adapter_type( void );
  222. VIOMODEINFO    PDC_get_scrn_mode( void );
  223. int    PDC_set_scrn_mode( VIOMODEINFO );
  224. bool   PDC_scrn_modes_equal (VIOMODEINFO, VIOMODEINFO);
  225. #else
  226. int    PDC_query_adapter_type( void );
  227. int    PDC_get_scrn_mode( void );
  228. int    PDC_set_scrn_mode( int );
  229. bool   PDC_scrn_modes_equal (int, int);
  230. #endif
  231. int    PDC_get_font( void );
  232. int    PDC_set_font( int );
  233. int    PDC_set_80x25( void );
  234. int    PDC_fix_cursor( int );
  235. int    PDC_get_rows( void );
  236. int    PDC_set_rows( int );
  237. int    PDC_putchar( chtype );
  238. int    PDC_clr_scrn( WINDOW* );
  239. int    PDC_gattr( void );
  240. int    PDC_gotoxy( int, int );
  241. int    PDC_print( int, int, int );
  242. int    PDC_chg_attr( WINDOW*, chtype, int, int, int, int );
  243. int    PDC_split_plane( WINDOW*, char*, char*, int, int, int, int );
  244. int    PDC_sanity_check( int );
  245. int    PDC_get_cursor_mode( void );
  246. int    PDC_set_cursor_mode( int, int );
  247. int    PDC_get_bios_key( void );
  248. int    PDC_putc( chtype, chtype );
  249. int    PDC_putctty( chtype, chtype );
  250. signed PDC_rawgetch( void );
  251. signed PDC_sysgetch( void );
  252. void   PDC_usleep( long );
  253. WINDOW*        PDC_makenew( int, int, int, int );
  254.  
  255. #ifdef FLEXOS
  256. int    PDC_flexos_8bitmode( void );
  257. int    PDC_flexos_16bitmode( void );
  258. char*  PDC_flexos_gname( void );
  259. #endif
  260.  
  261. #ifdef REGISTERWINDOWS
  262. bool   PDC_inswin( WINDOW*, WINDOW* );
  263. int    PDC_addtail( WINDOW* );
  264. int    PDC_addwin( WINDOW*, WINDOW* );
  265. int    PDC_rmwin( WINDOW* );
  266. WINDS* PDC_findwin( WINDOW* );
  267. #endif
  268. #  ifdef  CPLUSPLUS
  269.      }
  270. #  endif
  271. #endif
  272.  
  273. #define MAX_ATRTAB    272
  274.  
  275. /* internal macros for attributes */
  276. #define chtype_attr(ch)  ((atrtab[((ch >> 8) & 0xFF)] << 8) & A_ATTRIBUTES)
  277. #define phys_attr(ch)    (atrtab[((ch >> 8) & 0xFF)])
  278.  
  279. #endif /* __CURSES_INTERNALS__*/
  280.